package letapplyrunwith的区别

fun main() {
    val result = listOf(3, 2, 1).first().let {
        it * it
    }
    println(result)
    println(formatGreeting(null))
}

fun formatGreeting(guestName: String?): String {
    return guestName?.let {
        "Welcome,$it."
    } ?: "What's your name?"
}